local zcdiy_qiaoshi = fk.CreateSkill {
    name = "zcdiy_qiaoshi",
}

Fk:loadTranslationTable {
    ["zcdiy_qiaoshi"] = "樵拾",
    [":zcdiy_qiaoshi"] = "其他角色的牌因重铸而进入弃牌堆后，你可以获得这些牌或摸等量的牌。",

    ["$zcdiy_qiaoshi1"] = "采樵南山下，拾君一片心",
    ["$zcdiy_qiaoshi2"] = "山有木兮木成樵，心悦君兮君可知？",
}
zcdiy_qiaoshi:addEffect(fk.AfterCardsMove, {
    anim_type = "drawcard",
    can_trigger = function(self, event, target, player, data)
        if player:hasSkill(zcdiy_qiaoshi.name) then
            local ids = {}
            for _, move in ipairs(data) do
                if move.moveReason == fk.ReasonRecast and move.toArea == Card.DiscardPile and move.from and move.from ~= player then
                    for _, info in ipairs(move.moveInfo) do
                        table.insertIfNeed(ids, info.cardId)
                    end
                end
            end
            ids = table.filter(ids, function(id)
                return table.contains(player.room.discard_pile, id)
            end)
            ids = player.room.logic:moveCardsHoldingAreaCheck(ids)
            if #ids > 0 then
                event:setCostData(self, { cards = ids })
                return true
            end
        end
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        local cards = table.simpleClone(event:getCostData(self).cards)
        if room:askToSkillInvoke(player, { skill_name = zcdiy_qiaoshi.name, prompt = "樵拾：获得其重铸的牌，或点击取消摸" .. #cards .. "张牌" }) then
            room:moveCardTo(cards, Card.PlayerHand, player, fk.ReasonJustMove, zcdiy_qiaoshi.name, nil, true, player)
        else
            player:drawCards(#cards, zcdiy_qiaoshi.name)
        end
    end,
})
return zcdiy_qiaoshi
